﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using CommonLib.Pattern.FSM;
public class EnemySTChase2Patrol : EnemyStateTransitionBase
{
	protected Collider2D lastTarget;
	public EnemySTChase2Patrol(string _key, FSMStateBase _from, FSMStateBase _to, int _priority, RoleCtrl _role) : base(_key, _from, _to, _priority, _role)
	{

	}
	public override bool TransferValid()
	{
		if ((FromState as EnemyFSMStateChase).IsTimeOut())
		{
			(ToState as EnemyFSMStatePatrol).SetTarget((FromState as EnemyFSMStateChase).LastTarget);
			return true;
		}
		TransitionParam tp = GetTransistionParam(TransitionParamType.Chase);
		float vigilance = tp.VigilancePatrol;
		if (!FindNearestChase(vigilance, out Collider2D col))
		{
			//(ToState as EnemyFSMStateBase).SetTarget(col);
			return true;
		}
		else
			return false;
	}

	public override bool OnCompleteCallBack()
	{
		return base.OnCompleteCallBack();
	}
}
